#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 20010;
int e[11];
struct node
{
	int bh;
	int xh;
	int w;
	int c;
}a[N];

bool cmp(node x, node y)
{
	if (x.w == y.w) return x.bh < y.bh;
	return x.w > y.w;
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, k; cin >> n >> k;
	for (int i = 1; i <= 10; i++) cin >> e[i];
	for (int i = 1; i <= n; i++) {
		cin >> a[i].w;
		a[i].bh = i;
	}
	sort(a + 1, a + n + 1, cmp);
	for (int i = 1; i <= n; i++) {
		a[i].xh = i;
		a[i].c = (a[i].xh - 1) % 10 + 1;
		a[i].w += e[a[i].c];
	}
	sort(a + 1, a + n + 1, cmp);
	for (int i = 1; i <= k; i++) {
		cout << a[i].bh << " ";
	}
	cout << '\n';
	return 0;
}